package cn.itcast.order.service;

import cn.itcast.order.mapper.UserMapper;
import cn.itcast.order.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public User queryById(Long id) {
        if (id ==1){
         try{
             Thread.sleep(2000);  //睡两秒  模拟一个方法执行的时间是两秒
         }catch (InterruptedException e){
             e.printStackTrace();
         }

        }
        return userMapper.findById(id);
    }
}